package com.imCode.web;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by GO FOR IT on 2020/4/16.
 */
@WebServlet(name = "DemoServlet01")
public class DemoServlet01 extends HttpServlet {
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//        //1、从客户端获取一个参数
        String name = request.getParameter("name");

//        //2、请求转发到另外一个servlet
//        request.getRequestDispatcher("d2").forward(request,response);
//
//
//        //模拟从数据库获取用户的详细信息
//        request.setAttribute("name","rose");
//        request.setAttribute("age",20);
//        //请求转发到另一个jsp页面
//        request.getRequestDispatcher("d2.jsp").forward(request,response);


        response.sendRedirect("grades.html");


    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
